package com.fiberhome.app.network.socket;

import android.text.TextUtils;

import com.fiberhome.app.network.CacheBuilder;
import com.fiberhome.app.network.ISender;
import com.fiberhome.app.network.MD5Util;

/**
 * Created by Deed on 2018/1/18.
 */

public class TcpBuilder extends SocketBuilder {

    /**
     *
     */
    TcpPacket tcpPacket;

    /**
     *
     * @param port int
     * @param ipAddress String
     */
    TcpBuilder(int port, String ipAddress) {
        super(port, ipAddress);
    }

    @Override
    public ISender build() {
        return new TcpSender(this);
    }

    /**
     *
     * @param cache boolean
     * @return
     */
    public TcpBuilder useCache(int cache) {
        super.useCache(cache);
        return this;
    }

    /**
     *
     * @param cacheOverdue long
     * @return TcpBuilder
     */
    public TcpBuilder cacheOverdue(long cacheOverdue) {
        super.cacheOverdue(cacheOverdue);
        return this;
    }

    @Override
    public TcpBuilder sendData(String sendData) {
        super.sendData(sendData);
        return this;
    }

    /**
     * set value
     *
     * @param timeOut value
     */
    public TcpBuilder timeOut(int timeOut) {
        super.timeOut(timeOut);
        return this;
    }

    /**
     *
     * @param tcpPacket TcpPacket
     * @return TcpBuilder
     */
    public TcpBuilder packet(TcpPacket tcpPacket) {
        this.tcpPacket = tcpPacket;
        return this;
    }
}
